import React from 'react'

class LikesButton extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            likes: 0
        }
        // this.increaseLikes=this.increaseLikes.bind(this)

    }
    increaseLikes () {
        // alert("1234");
        // console.log(this)
        this.setState({
            likes: ++this.state.likes
        })
    }
    zero () {
        this.setState({
            likes: 0
        })
    }

    render () {
        return (
            <div className="likes-button-component">
                <button
                    type="button"
                    className="btn  btn-outline-primary btn-lg"
                    // onClick={this.increaseLikes}
                    onClick={() => { this.increaseLikes() }}
                >
                    👍{this.state.likes}
                </button>
                <button type="button"
                    className="btn  btn-outline-primary btn-lg"
                    onClick={() => { this.zero() }}
                >
                    ☠️清零
                    </button>
            </div>

        )

    }


}

export default LikesButton